#define _CRT_SECURE_NO_WARNINGS

#include <stdio.h>

int main()
{
	int num;
	int i=0;
	int j=0;
	char p[128] = { 0 };
	scanf("%d", &num);
	if (num == 0)
	{
		puts("0");
		return;
	}
	if (num < 0)
	{
		j = 1;
		num = -num;
		p[i++] = '-';
	}
	while(num)
	{	
		p[i++] = num%7+'0';
		num /= 7;
	}
	i--;
	char b;
	for (j; j < i; ++j,--i)
	{
		b = p[j];
		p[j] = p[i];
		p[i] = b;
	}
	printf("\"%s\"", p);
	return 0;
}